﻿using System;
using System.Reflection;

namespace QuickTest.Core.Compilation
{
    /// <summary>
    /// Class responsible for compiling all projects in a solution.
    /// </summary>
    public class CompileSolution : ICompilable<Solution>
    {
        private readonly ICompilable<Project> projectCompiler;

        public CompileSolution(ICompilable<Project> projectCompiler)
        {
            this.projectCompiler = projectCompiler;
        }

        public void Compile(Solution solution, ICompiler compiler, DirectoryUri outputDirectory)
        {
            foreach (var project in solution.Projects)
            {
                projectCompiler.Compile(project, compiler, outputDirectory);
            }
        }
    }
}